
JavaScript comment are two type one is multiline comment and another is single line comment. Commented code are not execute it just programmer or developer understand how to work the code or why this code are written. Now given bellow the JavaScript Comments code and explain the Comments code:
Single Line Comments: //x = 5; this variable declares and assign the value
Multi-line Comments: /* x = 5; variable declare and assign the value*/
Now given bellow the example code:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
/*Create the function
and recive the peramitar
and retun the addd name
*/
function Add(firstName,lastName){
return firstName +" "+lastName;
}
//recive the value
var result=Add("Farhan","Sakib");
//print the value
console.log(result);
</script>
</body>
</html>
Single line comment is use when we write Single code documentation but Multi-line Comments, comment use when we use Multi-line code documentation.